<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="js/jquery-1.11.3.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<button onclick="ajaxGet()">Ajax Get</button>
	<button onclick="ajaxPost()">Ajax Post</button>
	<button onclick="ajax()">Ajax</button>
</body>
<script type="text/javascript">
	function ajaxGet() {
		$.get(
			"/JavaWeb1907/ajax",
			{"name":"zhangsan","age":23},
			function(data){
				alert("name:"+data.name+"age:"+data.age);
			},
			"json"
		);
	}
	function ajaxPost(){
		$.post(
			"/JavaWeb1907/ajax",
			{"name":"zhangsan","age":23},
			function(data){
				alert("name:"+data.name+"age"+data.age);
			},
		);
	}
	function ajax() {
		// $.ajax( { option1:value1,option2:value2... } ); 
		$.ajax({
			/* async : true, */
			url:"/JavaWeb1907/ajax",
			data:{"name":"zhangsan","age":23},
			type:"post",
			dataType:"json",
			success:function(jsonObj){
				alert("name:"+jsonObj.name+",age"+jsonObj.age);
			}
		});
	}
</script>
</html>